Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Conversation

@carolinabtt
Copy link

resolves dbt-labs/dbt-adapters#583

Problem

When a model is Contract Enforced and the sql statement contains the _dbt_max_partition variable, dbt does not declare the variable before creating the cte.

This results in the following error:

  • Unrecognized name: _dbt_max_partition at ..

Solution

This PR fixes the bigquery__get_empty_subquery_sql macro, by checking 2 conditions:

  1. if the model is contact enforced
  2. if the model contains _dbt_max_partition variable

If the conditions are met, the _dbt_max_partition is declared.

@github-actions
Copy link
Contributor

This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

1 participant